package ru.dc.object;

import java.io.Serializable;

/**
 * <pre>
 * User: Penkov Vladimir
 * Date: 08.11.2010
 * Time: 17:20:51
 * </pre>
 */
public class FavouriteHub implements Serializable {

    private ServerInfo serverInfo = new ServerInfo();
    private String name;
    private boolean autoConnect;


    public boolean isAutoConnect() {
        return autoConnect;
    }

    public void setAutoConnect(boolean autoConnect) {
        this.autoConnect = autoConnect;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ServerInfo getServerInfo() {
        return serverInfo;
    }

    public void setServerInfo(ServerInfo serverInfo) {
        this.serverInfo = serverInfo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        FavouriteHub that = (FavouriteHub) o;

        if (autoConnect != that.autoConnect) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (serverInfo != null ? !serverInfo.equals(that.serverInfo) : that.serverInfo != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = serverInfo != null ? serverInfo.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (autoConnect ? 1 : 0);
        return result;
    }
}
